//
//  LSSocialWorkerFoundationInfoCollectViewController.m
//  LaSaCivilAffairsDepartment
//
//  Created by 聂志康 on 2019/1/9.
//  Copyright © 2019 wpkj. All rights reserved.
//

#import "LSSocialWorkerFoundationInfoCollectViewController.h"
#import "LSInfoCollectTableViewCell.h"
#import "LSDatePickViewController.h"
#import "LSInfoSelectController.h"
#import "NZKTextView.h"
#import "LSMultipleSelectView.h"

#define FontSize 14

@interface LSSocialWorkerFoundationInfoCollectViewController () <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, UITextViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *contentArray;
@property (nonatomic, strong) UIView *tableViewFooterView;
@property (nonatomic, strong) NSDictionary *downSelectDict;
@property (nonatomic, strong) NSArray *pickerDataArray;
@property (nonatomic, assign) BOOL isCheckedBefore;
@property (nonatomic, assign) BOOL isProfessional;
@property (nonatomic, strong) NSArray *contentArray_isProfessional;

@property (nonatomic, strong) UITextField *nameTF;//姓名(Y)
@property (nonatomic, strong) UITextField *personalIDCardTF;//身份证号(Y)
@property (nonatomic, strong) UITextField *sexTF;//性别
@property (nonatomic, strong) UITextField *birthdayTF;//生日(Y)
@property (nonatomic, strong) UITextField *politicsStatusTF;//政治面貌
@property (nonatomic, strong) UITextField *nationTF;//民族(Y)
@property (nonatomic, strong) UITextField *addressTF;//所在地区编号(Y)
@property (nonatomic, strong) UITextField *workerTypeTF;//社工类型(Y)
@property (nonatomic, strong) UITextField *certNumberTF;//证书管理号
@property (nonatomic, strong) UITextField *certLevTF;//证书等级
@property (nonatomic, strong) UITextField *certDateTF;//获取证书日期
@property (nonatomic, strong) UITextField *graduateSchoolTF;//毕业院校
@property (nonatomic, strong) UITextField *graduateDateTF;//毕业时间(Y)
@property (nonatomic, strong) UITextField *majorTF;//所属专业
@property (nonatomic, strong) UITextField *educationTF;//学历
@property (nonatomic, strong) UITextField *isWorkonsocialTF;//目前是否从事社会工作(Y)
@property (nonatomic, strong) UITextField *mailTF;//邮箱
@property (nonatomic, strong) NZKTextView *workOrgTV;//工作单位
@property (nonatomic, strong) UITextField *workOrgnatrueTF;//工作单位性质
@property (nonatomic, strong) NZKTextView *dutyTV;//职务
@property (nonatomic, strong) UITextField *fixedlineTelTF;//固定电话(Y)
@property (nonatomic, strong) UITextField *postalCodeTF;//邮编(Y)
@property (nonatomic, strong) NZKTextView *contactAddressTV;//联系地址
@property (nonatomic, strong) UITextField *telphoneTF;//手机号码(Y)
@property (nonatomic, strong) UITextField *workAreaTF;//工作领域(Y)
@property (nonatomic, strong) NZKTextView *specialityTV;//社会工作专长
@property (nonatomic, strong) NZKTextView *experienceTV;//社会工作经历

@property (nonatomic, strong) NSArray *sexTFArray;
@property (nonatomic, strong) NSArray *politicsStatusTFArray;
@property (nonatomic, strong) NSArray *nationTFArray;
@property (nonatomic, strong) NSArray *workerTypeTFArray;
@property (nonatomic, strong) NSArray *certLevTFArray;
@property (nonatomic, strong) NSArray *majorTFArray;
@property (nonatomic, strong) NSArray *educationTFArray;
@property (nonatomic, strong) NSArray *isWorkonsocialTFArray;
@property (nonatomic, strong) NSArray *workOrgnatrueTFArray;
@property (nonatomic, strong) NSArray *workAreaTFArray;
@end

static NSString *SocialWorkerFoundationInfoCollectCellID = @"SocialWorkerFoundationInfoCollectCellID";

@implementation LSSocialWorkerFoundationInfoCollectViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = UIColor.whiteColor;
    self.isCheckedBefore = false;
    [self loadKeyValues];
    if (self.isCheck) {
        self.isCheckedBefore = true;
//        if (!self.cannotEdit) {
//            UIButton *editButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 44)];
//            [editButton setTitle:@"编辑" forState:UIControlStateNormal];
//            [editButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
//            editButton.titleLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14];
//            [editButton addTarget:self action:@selector(editButtonClick) forControlEvents:UIControlEventTouchUpInside];
//            UIBarButtonItem *editItem = [[UIBarButtonItem alloc] initWithCustomView:editButton];
//            self.navigationItem.rightBarButtonItem = editItem;
//        }
        [self loadData];
        self.title = @"社工人员基础信息详情";
    } else {
        self.title = @"社工人员基础信息采集";
    }
    [self.view addSubview:self.tableView];
    if (self.isCheck) [self arrangeData];
}

- (void)getLocationInfoWithCode:(NSString *)code forTextField:(UITextField *)textField {
    if (![code isEqualToString:@""]) {
        NSString *shengCodeString = [NSString stringWithFormat:@"%@0000",[code substringToIndex:2]];
        NSString *shiCodeString = [NSString stringWithFormat:@"%@00",[code substringToIndex:4]];
        NSMutableString *shengshiquString = [[NSMutableString alloc] initWithString:@""];
        for (NSDictionary *shengDict in self.pickerDataArray) {
            if ([shengDict[@"areaId"] isEqualToString:shengCodeString]) {
                [shengshiquString appendString:shengDict[@"areaName"]];
                NSArray *citiesArray = shengDict[@"cities"];
                for (NSDictionary *shiDict in citiesArray) {
                    if ([shiDict[@"areaId"] isEqualToString:shiCodeString]) {
                        [shengshiquString appendFormat:@" %@",shiDict[@"areaName"]];
                        NSArray *quArray = shiDict[@"counties"];
                        for (NSDictionary *quDict in quArray) {
                            if ([quDict[@"areaId"] isEqualToString:code]) {
                                [shengshiquString appendFormat:@" %@",quDict[@"areaName"]];
                                break;
                            }
                        }
                        break;
                    }
                }
                break;
            }
        }
        textField.text = shengshiquString.copy;
        textField.placeholder = code;
    }
}

- (NSArray *)pickerDataArray {
    if (!_pickerDataArray) {
        NSData *JSONData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"city" ofType:@"json"]];
        _pickerDataArray = [NSJSONSerialization JSONObjectWithData:JSONData options:NSJSONReadingAllowFragments error:nil];
    }
    return _pickerDataArray;
}

- (void)loadKeyValues {
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:true];
    [NetworkUtils requestNOHandleWithMethod:@"POST" URL:ShgzDictionary param:@{@"token":[ValidateUtils validateNull:[UserInfoModel sharedInstance].token]} completionHandler:^(id responseObject, NSError *connectionError) {
        [hud hideAnimated:true];
        if (!connectionError) {
            NSNumber *status = [responseObject objectForKey:@"status"];
            if (status.integerValue == 200) {
                NSDictionary *dataDict = [responseObject objectForKey:@"data"];
                self.downSelectDict = dataDict;
                [self arrangeDownSelectArrays];
                if (self.isCheck) [self arrangeData];
            } else {
                [MBProgressHUD showTipMessageInWindow:[ValidateUtils validateNull:responseObject[@"message"]]];
            }
        } else {
            [MBProgressHUD showTipMessageInWindow:connectionError.localizedDescription];
        }
    }];
}

- (void)arrangeDownSelectArrays {
    NSArray *politics_statusArray = self.downSelectDict[@"politics_status"];//政治面貌
    if (politics_statusArray && politics_statusArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        [arrayM addObject:@"请选择"];
        for (NSDictionary *dict in politics_statusArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.politicsStatusTFArray = arrayM.copy;
        if (!self.isCheck && [self.politicsStatusTF.text isEqualToString:@""]) self.politicsStatusTF.text = arrayM.firstObject;
    }
    
    NSArray *social_worker_levelArray = self.downSelectDict[@"social_worker_level"];//证书等级
    if (social_worker_levelArray && social_worker_levelArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        [arrayM addObject:@"请选择"];
        for (NSDictionary *dict in social_worker_levelArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.certLevTFArray = arrayM.copy;
        if (!self.isCheck && [self.certLevTF.text isEqualToString:@""]) self.certLevTF.text = arrayM.firstObject;
    }
    
    NSArray *majorArray = self.downSelectDict[@"major"];//所属专业
    if (majorArray && majorArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        [arrayM addObject:@"请选择"];
        for (NSDictionary *dict in majorArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.majorTFArray = arrayM.copy;
        if (!self.isCheck && [self.majorTF.text isEqualToString:@""]) self.majorTF.text = arrayM.firstObject;
    }
    
    NSArray *educationArray = self.downSelectDict[@"education"];//学历
    if (educationArray && educationArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        [arrayM addObject:@"请选择"];
        for (NSDictionary *dict in educationArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.educationTFArray = arrayM.copy;
        if (!self.isCheck && [self.educationTF.text isEqualToString:@""]) self.educationTF.text = arrayM.firstObject;
    }
    
    NSArray *work_orgnatrueArray = self.downSelectDict[@"work_orgnatrue"];//工作单位性质
    if (work_orgnatrueArray && work_orgnatrueArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        [arrayM addObject:@"请选择"];
        for (NSDictionary *dict in work_orgnatrueArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.workOrgnatrueTFArray = arrayM.copy;
        if (!self.isCheck && [self.workOrgnatrueTF.text isEqualToString:@""]) self.workOrgnatrueTF.text = arrayM.firstObject;
    }
    
    NSArray *sexArray = self.downSelectDict[@"sex"];
    if (sexArray && sexArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        for (NSDictionary *dict in sexArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.sexTFArray = arrayM.copy;
//        if (!self.isCheck && [self.sexTF.text isEqualToString:@""]) self.sexTF.text = arrayM.firstObject;
    }
    
    NSArray *nationArray = self.downSelectDict[@"nation"];
    if (nationArray && nationArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        for (NSDictionary *dict in nationArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.nationTFArray = arrayM.copy;
        if (!self.isCheck && [self.nationTF.text isEqualToString:@""]) self.nationTF.text = arrayM.firstObject;
    }
    
    NSArray *worker_typeArray = self.downSelectDict[@"worker_type"];//社工类型
    if (worker_typeArray && worker_typeArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        for (NSDictionary *dict in worker_typeArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.workerTypeTFArray = arrayM.copy;
        if (!self.isCheck && [self.workerTypeTF.text isEqualToString:@""]) self.workerTypeTF.text = arrayM.firstObject;
    }
    
    NSArray *is_publishArray = self.downSelectDict[@"is_publish"];//目前是否从事社会工作
    if (is_publishArray && is_publishArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        for (NSDictionary *dict in is_publishArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.isWorkonsocialTFArray = arrayM.copy;
        if (!self.isCheck && [self.isWorkonsocialTF.text isEqualToString:@""]) self.isWorkonsocialTF.text = arrayM.firstObject;
    }
    
    NSArray *work_areaArray = self.downSelectDict[@"work_area"];//工作领域
    if (work_areaArray && work_areaArray.count > 0) {
        NSMutableArray *arrayM = [[NSMutableArray alloc] initWithArray:@[]];
        for (NSDictionary *dict in work_areaArray) {
            [arrayM addObject:[ValidateUtils validateNull:dict[@"value"]]];
        }
        self.workAreaTFArray = arrayM.copy;
        if (!self.isCheck && [self.workAreaTF.text isEqualToString:@""]) self.workAreaTF.text = arrayM.firstObject;
    }
}

- (void)editButtonClickWithJump:(BOOL)JUMP {
    self.isCheck = false;
    self.navigationItem.rightBarButtonItem = nil;
    if (JUMP) {
        self.title = @"社工人员基础信息编辑";
    } else {
        self.title = @"社工人员基础信息采集";
    }
    self.tableView.tableFooterView = self.tableViewFooterView;
    
    [self.sexTF removeFromSuperview];
    self.sexTF = nil;
    [self.birthdayTF removeFromSuperview];
    self.birthdayTF = nil;
    [self.politicsStatusTF removeFromSuperview];
    self.politicsStatusTF = nil;
    [self.nationTF removeFromSuperview];
    self.nationTF = nil;
    [self.addressTF removeFromSuperview];
    self.addressTF = nil;
    [self.workerTypeTF removeFromSuperview];
    self.workerTypeTF = nil;
    [self.certLevTF removeFromSuperview];
    self.certLevTF = nil;
    [self.certDateTF removeFromSuperview];
    self.certDateTF = nil;
    [self.graduateDateTF removeFromSuperview];
    self.graduateDateTF = nil;
    [self.majorTF removeFromSuperview];
    self.majorTF = nil;
    [self.educationTF removeFromSuperview];
    self.educationTF = nil;
    [self.isWorkonsocialTF removeFromSuperview];
    self.isWorkonsocialTF = nil;
    [self.workOrgnatrueTF removeFromSuperview];
    self.workOrgnatrueTF = nil;
    [self.workAreaTF removeFromSuperview];
    self.workAreaTF = nil;
    
    [self arrangeData];
    [self.tableView reloadData];
}

- (void)loadData {
    [NetworkUtils requestNOHandleWithMethod:@"POST" URL:LSSocialWorkerDetail param:@{@"token":[ValidateUtils validateNull:[UserInfoModel sharedInstance].token],@"id":self.displayDataDict[@"id"]} completionHandler:^(id responseObject, NSError *connectionError) {
        if (!connectionError) {
            NSNumber *status = [responseObject objectForKey:@"status"];
            if (status.integerValue == 200) {
                NSArray *dataArray = [responseObject objectForKey:@"data"];
                if (dataArray && dataArray.count > 0) {
                    self.displayDataDict = dataArray.firstObject;
                    if (self.displayDataDict && self.displayDataDict.count > 0) [self arrangeData];
                    if (self.jumpToEdit) [self editButtonClickWithJump:true];
                    [self.tableView reloadData];
                }
            } else {
                [MBProgressHUD showTipMessageInWindow:[ValidateUtils validateNull:responseObject[@"message"]]];
            }
        } else {
            [MBProgressHUD showTipMessageInWindow:connectionError.localizedDescription];
        }
    }];
}

- (void)arrangeData {
    NSArray *politics_statusArray = self.downSelectDict[@"politics_status"];//政治面貌
    NSArray *social_worker_levelArray = self.downSelectDict[@"social_worker_level"];//证书等级
    NSArray *majorArray = self.downSelectDict[@"major"];//所属专业
    NSArray *educationArray = self.downSelectDict[@"education"];//学历
    NSArray *work_orgnatrueArray = self.downSelectDict[@"work_orgnatrue"];//工作单位性质
    NSArray *sexArray = self.downSelectDict[@"sex"];
    NSArray *nationArray = self.downSelectDict[@"nation"];
    NSArray *worker_typeArray = self.downSelectDict[@"worker_type"];//社工类型
    NSArray *is_publishArray = self.downSelectDict[@"is_publish"];//目前是否从事社会工作
    NSArray *work_areaArray = self.downSelectDict[@"work_area"];//工作领域
    
    self.nameTF.text = [ValidateUtils validateNull:self.displayDataDict[@"name"]];//姓名(Y)
    self.personalIDCardTF.text = [ValidateUtils validateNull:self.displayDataDict[@"idCard"]];//身份证号(Y)
    NSString *sexString = @"";
    for (NSDictionary *dict in sexArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"sex"]]]) {
            sexString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.sexTF.text = sexString;//self.sexTFArray[[ValidateUtils validateNull:self.displayDataDict[@"sex"]].integerValue];//性别(Y)
    self.birthdayTF.text = [self timeStampToDate:self.displayDataDict[@"birthday"]];//生日(Y)
    NSString *politics_statusString = @"";
    for (NSDictionary *dict in politics_statusArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"politicsStatus"]]]) {
            politics_statusString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.politicsStatusTF.text = politics_statusString;//self.politicsStatusTFArray[[self validateSelect:self.displayDataDict[@"politicsStatus"]]==0?0:[self validateSelect:self.displayDataDict[@"politicsStatus"]]-1];//政治面貌
    NSString *nationString = @"";
    for (NSDictionary *dict in nationArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"nation"]]]) {
            nationString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.nationTF.text = nationString;//self.nationTFArray[[ValidateUtils validateNull:self.displayDataDict[@"nation"]].integerValue];//民族(Y)
    self.addressTF.text = [ValidateUtils validateNull:self.displayDataDict[@"addressName"]];
    self.addressTF.placeholder = [ValidateUtils validateNull:self.displayDataDict[@"address"]];
//    self.addressTextTV.text = [ValidateUtils validateNull:self.displayDataDict[@"addressText"]];//所在地区名称(Y)
    NSString *worker_typeString = @"";
    for (NSDictionary *dict in worker_typeArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"workerType"]]]) {
            worker_typeString = [ValidateUtils validateNull:dict[@"value"]];
            if ([worker_typeString isEqualToString:@"专业"]) {
                self.isProfessional = true;
            } else {
                self.isProfessional = false;
            }
        }
    }
    self.workerTypeTF.text = worker_typeString;//self.workerTypeTFArray[[self validateSelect:self.displayDataDict[@"workerType"]]==0?0:[self validateSelect:self.displayDataDict[@"workerType"]]];//社工类型(Y)
    self.certNumberTF.text = [ValidateUtils validateNull:self.displayDataDict[@"certNumber"]];//证书管理号
    NSString *social_worker_levelString = @"";
    for (NSDictionary *dict in social_worker_levelArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"certLev"]]]) {
            social_worker_levelString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.certLevTF.text = social_worker_levelString;//self.certLevTFArray[[self validateSelect:self.displayDataDict[@"certLev"]]==0?0:[self validateSelect:self.displayDataDict[@"certLev"]]];//证书等级
    self.certDateTF.text = [self timeStampToDate:self.displayDataDict[@"certDate"]];//获取证书日期
    self.graduateSchoolTF.text = [ValidateUtils validateNull:self.displayDataDict[@"graduateSchool"]];//毕业院校
    self.graduateDateTF.text = [self timeStampToDate:self.displayDataDict[@"graduateDate"]];//毕业时间(Y)
    NSString *majorString = @"";
    for (NSDictionary *dict in majorArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"major"]]]) {
            majorString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.majorTF.text = majorString;//self.majorTFArray[[self validateSelect:self.displayDataDict[@"major"]]==0?0:[self validateSelect:self.displayDataDict[@"major"]]];//所属专业
    NSString *educationString = @"";
    for (NSDictionary *dict in educationArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"education"]]]) {
            educationString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.educationTF.text = educationString;//self.educationTFArray[[self validateSelect:self.displayDataDict[@"education"]]==0?0:[self validateSelect:self.displayDataDict[@"education"]]];//学历
    NSString *is_publishString = @"";
    for (NSDictionary *dict in is_publishArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"isWorkonsocial"]]]) {
            is_publishString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.isWorkonsocialTF.text = is_publishString;//self.isWorkonsocialTFArray[[self validateSelect:self.displayDataDict[@"isWorkonsocial"]]==0?0:[self validateSelect:self.displayDataDict[@"isWorkonsocial"]]];//目前是否从事社会工作(Y)
    self.mailTF.text = [ValidateUtils validateNull:self.displayDataDict[@"mail"]];//邮箱
    self.workOrgTV.text = [ValidateUtils validateNull:self.displayDataDict[@"workOrg"]];//工作单位
    NSString *work_orgnatrueString = @"";
    for (NSDictionary *dict in work_orgnatrueArray) {
        if ([dict[@"id"] isEqualToString:[ValidateUtils validateNull:self.displayDataDict[@"workOrgnatrue"]]]) {
            work_orgnatrueString = [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    self.workOrgnatrueTF.text = work_orgnatrueString;//self.workOrgnatrueTFArray[[self validateSelect:self.displayDataDict[@"workOrgnatrue"]]==0?0:[self validateSelect:self.displayDataDict[@"workOrgnatrue"]]];//工作单位性质
    self.dutyTV.text = [ValidateUtils validateNull:self.displayDataDict[@"duty"]];//职务
    self.fixedlineTelTF.text = [ValidateUtils validateNull:self.displayDataDict[@"fixedlineTel"]];//固定电话(Y)
    self.postalCodeTF.text = [ValidateUtils validateNull:self.displayDataDict[@"postalCode"]];//邮编(Y)
    self.contactAddressTV.text = [ValidateUtils validateNull:self.displayDataDict[@"contactAddress"]];//联系地址
    self.telphoneTF.text = [ValidateUtils validateNull:self.displayDataDict[@"telphone"]];//手机号码(Y)

    NSMutableString *work_areaStringM = [[NSMutableString alloc] initWithString:@""];
    NSArray *work_areaStringArray = [[ValidateUtils validateNull:self.displayDataDict[@"workArea"]] componentsSeparatedByString:@","];
    for (NSString *work_areaId in work_areaStringArray) {
        [work_areaStringM appendFormat:@"%@ ",[self getValueById:work_areaId fromArray:work_areaArray]];
    }
    self.workAreaTF.text = [work_areaStringM substringToIndex:work_areaStringM.length-1];
    
    self.specialityTV.text = [ValidateUtils validateNull:self.displayDataDict[@"speciality"]];//社会工作专长
    self.experienceTV.text = [ValidateUtils validateNull:self.displayDataDict[@"experience"]];//社会工作经历
    
    [self.tableView reloadData];
}

- (NSInteger)validateSelect:(NSString *)string {
    if (!string || [string isKindOfClass:[NSNull class]]) {
        return 0;
    } else {
        return string.integerValue;
    }
}

- (NSString *)timeStampToDate:(NSString *)timeStampString {
    // iOS 生成的时间戳是10位
    if (![[ValidateUtils validateNull:timeStampString] isEqualToString:@""] && !([ValidateUtils validateNull:timeStampString].integerValue == 0)) {
        NSTimeInterval interval    =[timeStampString doubleValue] / 1000.0;
        NSDate *date               = [NSDate dateWithTimeIntervalSince1970:interval];
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat:@"yyyy-MM-dd"];
        return [formatter stringFromDate: date];
    }
    return @"";
}

- (void)setDisplayDataDict:(NSDictionary *)displayDataDict {
    _displayDataDict = displayDataDict;
}

#pragma mark - 提交
- (void)submitButtonClick {
    if ([self.nameTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请输入姓名"];
        return;
    }
    if ([self.personalIDCardTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请输入身份证号"];
        return;
    }
    if (![ValidateUtils validateIDCardNumber:self.personalIDCardTF.text]) {
        [MBProgressHUD showTipMessageInWindow:@"身份证号输入有误"];
        return;
    }
//    if ([self.birthdayTF.text isEqualToString:@""]) {
//        [MBProgressHUD showTipMessageInWindow:@"请选择出生日期"];
//        return;
//    }
    if ([self.nationTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择您的民族"];
        return;
    }
    if ([self.addressTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择您所在地区"];
        return;
    }
//    if ([self.addressTextTV.text isEqualToString:@""]) {
//        [MBProgressHUD showTipMessageInWindow:@"请输入详细地址"];
//        return;
//    }
    if ([self.workerTypeTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择社工类型"];
        return;
    }
    
    if (self.isProfessional && [self.certNumberTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请输入证书管理号"];
        return;
    }
    if (self.isProfessional && [self.certLevTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择证书等级"];
        return;
    }
    if (self.isProfessional && [self.certDateTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择获取证书日期"];
        return;
    }
    
    if ([self.graduateDateTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择毕业时间"];
        return;
    }
    if (![self.mailTF.text isEqualToString:@""] && ![ValidateUtils validateEmail:self.mailTF.text]) {
        [MBProgressHUD showTipMessageInWindow:@"邮箱填写有误"];
        return;
    }
    if ([self.isWorkonsocialTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择您目前是否从事社会工作"];
        return;
    }
    if ([self.fixedlineTelTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请输入您的固定电话"];
        return;
    }
    if (![ValidateUtils validateMobile:self.fixedlineTelTF.text]) {
        [MBProgressHUD showTipMessageInWindow:@"您的固定电话输入有误"];
        return;
    }
    if (![self.postalCodeTF.text isEqualToString:@""] && ![ValidateUtils validatePostcode:self.postalCodeTF.text]) {
        [MBProgressHUD showTipMessageInWindow:@"邮编输入有误"];
        return;
    }
    if ([self.telphoneTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请输入手机号码"];
        return;
    }
    if (![ValidateUtils validateMobile:self.telphoneTF.text]) {
        [MBProgressHUD showTipMessageInWindow:@"手机号码输入有误"];
        return;
    }
    if ([self.workAreaTF.text isEqualToString:@""]) {
        [MBProgressHUD showTipMessageInWindow:@"请选择您的工作领域"];
        return;
    }
    
    NSArray *politics_statusArray = self.downSelectDict[@"politics_status"];//政治面貌
    NSArray *social_worker_levelArray = self.downSelectDict[@"social_worker_level"];//证书等级
    NSArray *majorArray = self.downSelectDict[@"major"];//所属专业
    NSArray *educationArray = self.downSelectDict[@"education"];//学历
    NSArray *work_orgnatrueArray = self.downSelectDict[@"work_orgnatrue"];//工作单位性质
    NSArray *sexArray = self.downSelectDict[@"sex"];
    NSArray *nationArray = self.downSelectDict[@"nation"];
    NSArray *worker_typeArray = self.downSelectDict[@"worker_type"];//社工类型
    NSArray *is_publishArray = self.downSelectDict[@"is_publish"];//目前是否从事社会工作
    NSArray *work_areaArray = self.downSelectDict[@"work_area"];//工作领域
    NSMutableDictionary *paramM = [[NSMutableDictionary alloc] initWithDictionary:@{
                                                                             @"token":[ValidateUtils validateNull:[UserInfoModel sharedInstance].token],
                                                                             @"name":self.nameTF.text,
                                                                             @"idCard":self.personalIDCardTF.text,
                                                                             @"birthday":self.birthdayTF.text,
                                                                             @"nation":[self getIdByValue:self.nationTF.text fromArray:nationArray],
                                                                             @"address":self.addressTF.placeholder,
                                                                             @"workerType":[self getIdByValue:self.workerTypeTF.text fromArray:worker_typeArray],
                                                                             @"certNumber":self.certNumberTF.text,
                                                                             @"certDate":self.certDateTF.text,
                                                                             @"graduateSchool":self.graduateSchoolTF.text,
                                                                             @"graduateDate":self.graduateDateTF.text,
                                                                             @"isWorkonsocial":[self getIdByValue:self.isWorkonsocialTF.text fromArray:is_publishArray],
                                                                             @"mail":self.mailTF.text,
                                                                             @"workOrg":self.workOrgTV.text,
                                                                             @"duty":self.dutyTV.text,
                                                                             @"fixedlineTel":self.fixedlineTelTF.text,
                                                                             @"postalCode":self.postalCodeTF.text,
                                                                             @"contactAddress":self.contactAddressTV.text,
                                                                             @"telphone":self.telphoneTF.text,
                                                                             @"speciality":self.specialityTV.text,
                                                                             @"experience":self.experienceTV.text
                                                                             }];

    NSMutableString *workAreaTFStringM = [[NSMutableString alloc] initWithString:@""];
    NSArray *workAreaTFStringArray = [self.workAreaTF.text componentsSeparatedByString:@" "];
    for (NSString *workArea in workAreaTFStringArray) {
        [workAreaTFStringM appendFormat:@"%@,",[self getIdByValue:workArea fromArray:work_areaArray]];
    }
    [paramM setValue:[workAreaTFStringM substringToIndex:workAreaTFStringM.length-1] forKey:@"workArea"];
    
    if (![self.sexTF.text isEqualToString:@""]) {
        [paramM setValue:[self getIdByValue:self.sexTF.text fromArray:sexArray] forKey:@"sex"];
    } else {
        [paramM setValue:@"" forKey:@"sex"];
    }
    if (![self.politicsStatusTF.text isEqualToString:@""]) {
        [paramM setValue:[self getIdByValue:self.politicsStatusTF.text fromArray:politics_statusArray] forKey:@"politicsStatus"];
    } else {
        [paramM setValue:@"" forKey:@"politicsStatus"];
    }
    if (![self.certLevTF.text isEqualToString:@""]) {
        [paramM setValue:[self getIdByValue:self.certLevTF.text fromArray:social_worker_levelArray] forKey:@"certLev"];
    } else {
        [paramM setValue:@"" forKey:@"certLev"];
    }
    if (![self.majorTF.text isEqualToString:@""]) {
        [paramM setValue:[self getIdByValue:self.majorTF.text fromArray:majorArray] forKey:@"major"];
    } else {
        [paramM setValue:@"" forKey:@"major"];
    }
    if (![self.educationTF.text isEqualToString:@""]) {
        [paramM setValue:[self getIdByValue:self.educationTF.text fromArray:educationArray] forKey:@"education"];
    } else {
        [paramM setValue:@"" forKey:@"education"];
    }
    if (![self.workOrgnatrueTF.text isEqualToString:@""]) {
        [paramM setValue:[self getIdByValue:self.workOrgnatrueTF.text fromArray:work_orgnatrueArray] forKey:@"workOrgnatrue"];
    } else {
        [paramM setValue:@"" forKey:@"workOrgnatrue"];
    }
    NSString *URL = LsshgzAdd;
    if (self.isCheckedBefore) {
        URL = LSSocialWorkerUpdate;
        [paramM setValue:self.displayDataDict[@"id"] forKey:@"id"];
    }
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:true];
    [NetworkUtils requestNOHandleWithMethod:@"POST" URL:URL param:paramM.copy completionHandler:^(id responseObject, NSError *connectionError) {
        [hud hideAnimated:true];
        if (!connectionError) {
            NSNumber *status = [responseObject objectForKey:@"status"];
            if (status.integerValue == 200) {
                if (self.isCheckedBefore) {
                    if (![[ValidateUtils validateNull:responseObject[@"message"]] isEqualToString:@""]) {
                        [MBProgressHUD showTipMessageInWindow:responseObject[@"message"]];
                    }
                } else {
                    if (![[ValidateUtils validateNull:responseObject[@"message"]] isEqualToString:@""]) {
                        [MBProgressHUD showTipMessageInWindow:responseObject[@"message"]];
                    }
                }
                if (self.refreshBlock) {
                    self.refreshBlock();
                }
                WS
                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    [weakSelf.navigationController popViewControllerAnimated:true];
                });
            } else {
                if (![[ValidateUtils validateNull:responseObject[@"message"]] isEqualToString:@""]) {
                    [MBProgressHUD showTipMessageInWindow:responseObject[@"message"]];
                }
            }
        } else {
            [MBProgressHUD showTipMessageInWindow:connectionError.localizedDescription];
        }
    }];
}

- (NSString *)getValueById:(NSString *)Id fromArray:(NSArray *)dateArray {
    for (NSDictionary *dict in dateArray) {
        if (![[ValidateUtils validateNull:dict[@"id"]] isEqualToString:@""] && [dict[@"id"] isEqualToString:Id]) {
            return [ValidateUtils validateNull:dict[@"value"]];
        }
    }
    return @"";
}

- (NSString *)getIdByValue:(NSString *)value fromArray:(NSArray *)dateArray {
    for (NSDictionary *dict in dateArray) {
        if (![[ValidateUtils validateNull:dict[@"value"]] isEqualToString:@""] && [dict[@"value"] isEqualToString:value]) {
            return [ValidateUtils validateNull:dict[@"id"]];
        }
    }
    return @"";
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (self.isProfessional) {
        return self.contentArray_isProfessional.count;
    } else {
        return self.contentArray.count;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    LSInfoCollectTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SocialWorkerFoundationInfoCollectCellID forIndexPath:indexPath];
    if (self.isProfessional) {
        cell.leftLabel.text = self.contentArray_isProfessional[indexPath.row];
    } else {
        cell.leftLabel.text = self.contentArray[indexPath.row];
    }
    [cell.leftLabel sizeToFit];
    if (self.isCheck) {
        cell.xingImageView.hidden = true;
    } else {
        if ((indexPath.row == 2 || indexPath.row == 4 || indexPath.row == 11 || indexPath.row == 13 || indexPath.row == 14 || indexPath.row == 16 || indexPath.row == 17 || indexPath.row == 18 || indexPath.row == 19 || indexPath.row == 21 || indexPath.row == 22 || indexPath.row == 25 || indexPath.row == 26) && self.isProfessional) {
            cell.xingImageView.hidden = true;
        } else if ((indexPath.row == 2 || indexPath.row == 4 || indexPath.row == 8 || indexPath.row == 10 || indexPath.row == 11 || indexPath.row == 13 || indexPath.row == 14 || indexPath.row == 15 || indexPath.row == 16 || indexPath.row == 18 || indexPath.row == 19 || indexPath.row == 22 || indexPath.row == 23) && !self.isProfessional) {
            cell.xingImageView.hidden = true;
        } else {
            cell.xingImageView.hidden = false;
        }
    }
    
    for (UIView *subView in cell.contentView.subviews) {
        if ([subView isKindOfClass:UITextField.class] || [subView isKindOfClass:[UITextView class]]) {
            [subView removeFromSuperview];
        }
    }
    
    LSInfoCollectTableViewCell *currentCell = cell;
    if (indexPath.row == 0) {
        [currentCell.contentView addSubview:self.nameTF];
        [self.nameTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 1) {
        [currentCell.contentView addSubview:self.personalIDCardTF];
        [self.personalIDCardTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 2) {
        [currentCell.contentView addSubview:self.sexTF];
        [self.sexTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 3) {
        [currentCell.contentView addSubview:self.birthdayTF];
        [self.birthdayTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 4) {
        [currentCell.contentView addSubview:self.politicsStatusTF];
        [self.politicsStatusTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 5) {
        [currentCell.contentView addSubview:self.nationTF];
        [self.nationTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 6) {
        [currentCell.contentView addSubview:self.addressTF];
        [self.addressTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 7) {
        [currentCell.contentView addSubview:self.workerTypeTF];
        [self.workerTypeTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 8 && self.isProfessional) {
        [currentCell.contentView addSubview:self.certNumberTF];
        [self.certNumberTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 9 && self.isProfessional) {
        [currentCell.contentView addSubview:self.certLevTF];
        [self.certLevTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if (indexPath.row == 10 && self.isProfessional) {
        [currentCell.contentView addSubview:self.certDateTF];
        [self.certDateTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 11 && self.isProfessional) || (indexPath.row == 8 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.graduateSchoolTF];
        [self.graduateSchoolTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 12 && self.isProfessional) || (indexPath.row == 9 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.graduateDateTF];
        [self.graduateDateTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 13 && self.isProfessional) || (indexPath.row == 10 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.majorTF];
        [self.majorTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 14 && self.isProfessional) || (indexPath.row == 11 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.educationTF];
        [self.educationTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 15 && self.isProfessional) || (indexPath.row == 12 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.isWorkonsocialTF];
        [self.isWorkonsocialTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 16 && self.isProfessional) || (indexPath.row == 13 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.mailTF];
        [self.mailTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 17 && self.isProfessional) || (indexPath.row == 14 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.workOrgTV];
        [self.workOrgTV mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 18 && self.isProfessional) || (indexPath.row == 15 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.workOrgnatrueTF];
        [self.workOrgnatrueTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 19 && self.isProfessional) || (indexPath.row == 16 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.dutyTV];
        [self.dutyTV mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 20 && self.isProfessional) || (indexPath.row == 17 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.fixedlineTelTF];
        [self.fixedlineTelTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 21 && self.isProfessional) || (indexPath.row == 18 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.postalCodeTF];
        [self.postalCodeTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 22 && self.isProfessional) || (indexPath.row == 19 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.contactAddressTV];
        [self.contactAddressTV mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 23 && self.isProfessional) || (indexPath.row == 20 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.telphoneTF];
        [self.telphoneTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 24 && self.isProfessional) || (indexPath.row == 21 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.workAreaTF];
        [self.workAreaTF mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 25 && self.isProfessional) || (indexPath.row == 22 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.specialityTV];
        [self.specialityTV mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    } else if ((indexPath.row == 26 && self.isProfessional) || (indexPath.row == 23 && !self.isProfessional)) {
        [currentCell.contentView addSubview:self.experienceTV];
        [self.experienceTV mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(currentCell.leftLabel.mas_right).with.offset(12);
            make.right.equalTo(currentCell.contentView.mas_right).with.offset(-15);
            make.top.equalTo(currentCell.contentView.mas_top).with.offset(8);
            make.bottom.equalTo(currentCell.contentView.mas_bottom);
        }];
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:true];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if ((indexPath.row == 17 && self.isProfessional) || (indexPath.row == 14 && !self.isProfessional)) {// 工作单位
        CGRect TitleRectt = [@"详细地址：" boundingRectWithSize:CGSizeMake(ScreenWidth, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14]} context:nil];
        CGRect TitleRect = [self.workOrgTV.text boundingRectWithSize:CGSizeMake(ScreenWidth-15-12-30-TitleRectt.size.width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize]} context:nil];
        return TitleRect.size.height+8+20+18;
    } else if ((indexPath.row == 19 && self.isProfessional) || (indexPath.row == 16 && !self.isProfessional)) {// 联系地址
        CGRect TitleRectt = [@"职务：" boundingRectWithSize:CGSizeMake(ScreenWidth, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14]} context:nil];
        CGRect TitleRect = [self.dutyTV.text boundingRectWithSize:CGSizeMake(ScreenWidth-15-12-30-TitleRectt.size.width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize]} context:nil];
        return TitleRect.size.height+8+20+18;
    } else if ((indexPath.row == 22 && self.isProfessional) || (indexPath.row == 19 && !self.isProfessional)) {// 联系地址
        CGRect TitleRectt = [@"联系地址：" boundingRectWithSize:CGSizeMake(ScreenWidth, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14]} context:nil];
        CGRect TitleRect = [self.contactAddressTV.text boundingRectWithSize:CGSizeMake(ScreenWidth-15-12-30-TitleRectt.size.width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize]} context:nil];
        return TitleRect.size.height+8+20+18;
    } else if ((indexPath.row == 25 && self.isProfessional) || (indexPath.row == 22 && !self.isProfessional)) {
        CGRect TitleRectt = [@"社会工作专长：" boundingRectWithSize:CGSizeMake(ScreenWidth, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14]} context:nil];
        CGRect TitleRect = [self.specialityTV.text boundingRectWithSize:CGSizeMake(ScreenWidth-15-12-30-TitleRectt.size.width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize]} context:nil];
        return TitleRect.size.height+8+20+18;
    } else if ((indexPath.row == 26 && self.isProfessional) || (indexPath.row == 23 && !self.isProfessional)) {
        CGRect TitleRectt = [@"社会工作经历：" boundingRectWithSize:CGSizeMake(ScreenWidth, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14]} context:nil];
        CGRect TitleRect = [self.experienceTV.text boundingRectWithSize:CGSizeMake(ScreenWidth-15-12-30-TitleRectt.size.width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize]} context:nil];
        return TitleRect.size.height+8+20+18;
    }
    return 44;
}
    
#pragma mark - 弹窗
- (void)showSelectControllerForTextField:(UITextField *)textField WithContentArray:(NSArray *)contentArray {
    UIAlertController *alertC = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    for (int i = 0; i < contentArray.count; i++) {
        [alertC addActionTarget:alertC title:contentArray[i] color:NAV_COLOR action:^(UIAlertAction *action) {
            textField.text = contentArray[i];
            if (textField == self.workerTypeTF) {
                if ([textField.text isEqualToString:@"从业"]) {
                    self.isProfessional = false;
                } else {
                    self.isProfessional = true;
                }
                [self.tableView reloadData];
            }
        }];
    }
    [alertC addCancelActionTarget:alertC color:NAV_COLOR title:@"取消"];
    [self presentViewController:alertC animated:true completion:nil];
}

- (void)showMultipleSelectViewWithArray:(NSArray *)selectArray forTextfield:(UITextField *)selectTF {
    NSMutableArray *selectArrayM = [[NSMutableArray alloc] initWithArray:selectArray];
    [selectArrayM removeObjectAtIndex:0];
    NSArray *selectedArray = @[];
    if (![selectTF.text isEqualToString:@"请选择"] && ![[ValidateUtils validateNull:selectTF.text] isEqualToString:@""]) {
        selectedArray = [selectTF.text componentsSeparatedByString:@" "];
    }
    LSMultipleSelectView *selectedView = [[LSMultipleSelectView alloc] initWithSelectObjects:selectArrayM.copy andSelectedObjects:selectedArray didSelectObjects:^(NSArray * _Nonnull selectObjects) {
        if (selectObjects.count > 0) {
            NSMutableString *stringM = [[NSMutableString alloc] initWithString:@""];
            for (NSString *string in selectObjects) {
                [stringM appendFormat:@"%@ ",string];
            }
            selectTF.text = [stringM substringToIndex:stringM.length-1];
        } else {
            selectTF.text = @"请选择";
        }
    }];
    [selectedView show];
}

- (void)showDateSelectControllerForTextField:(UITextField *)textField WithTitle:(NSString *)title {
    LSDatePickViewController *alertVC = [LSDatePickViewController alertControllerWithTitle:[NSString stringWithFormat:@"%@\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",title] message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    alertVC.datePicker.datePickerMode = UIDatePickerModeDate;
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        // 获取当前datePicker上面选择的时间
        NSDate *date = alertVC.datePicker.date;
        //    NSLog(@"-----%@", date);
        // 创建时间格式化工具
        NSDateFormatter *df = [[NSDateFormatter alloc] init];
        df.dateFormat = @"yyyy-MM-dd";
        NSString *str = [df stringFromDate:date];
        textField.text = [NSString stringWithFormat:@"%@",str];
        textField.backgroundColor = UIColor.whiteColor;
    }];
    [alertVC addAction:cancelAction];
    [alertVC addAction:okAction];
    [self presentViewController:alertVC animated:YES completion:nil];
}

- (void)showLocationSelectControllerForTextField:(UITextField *)textField WithTitle:(NSString *)title {
    LSInfoSelectController *locationSelectC = [LSInfoSelectController alertControllerWithTitle:[NSString stringWithFormat:@"%@\n\n\n\n\n\n\n\n\n\n\n\n\n\n",title] message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        textField.text = [NSString stringWithFormat:@"%@  %@  %@",locationSelectC.pickerViewSelectedShengString,locationSelectC.pickerViewSelectedShiString,locationSelectC.pickerViewSelectedQuString];
        textField.placeholder = locationSelectC.pickerViewSelectedCode;
    }];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    [locationSelectC addAction:confirmAction];
    [locationSelectC addAction:cancelAction];
    [self presentViewController:locationSelectC animated:true completion:nil];
}

#pragma mark - UITextFieldDelegate
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    if (textField == self.sexTF) {
//        if (!self.isCheck) [self showSelectControllerForTextField:self.sexTF WithContentArray:self.sexTFArray];
        return false;
    } else if (textField == self.birthdayTF) {
//        if (!self.isCheck) [self showDateSelectControllerForTextField:self.birthdayTF WithTitle:@"请选择出生日期"];
        return false;
    } else if (textField == self.certDateTF) {
        if (!self.isCheck) [self showDateSelectControllerForTextField:self.certDateTF WithTitle:@"请选择获取证书日期"];
        return false;
    } else if (textField == self.graduateDateTF) {
        if (!self.isCheck) [self showDateSelectControllerForTextField:self.graduateDateTF WithTitle:@"请选择毕业时间"];
        return false;
    } else if (textField == self.politicsStatusTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.politicsStatusTF WithContentArray:self.politicsStatusTFArray];
        return false;
    } else if (textField == self.nationTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.nationTF WithContentArray:self.nationTFArray];
        return false;
    } else if (textField == self.workerTypeTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.workerTypeTF WithContentArray:self.workerTypeTFArray];
        return false;
    } else if (textField == self.certLevTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.certLevTF WithContentArray:self.certLevTFArray];
        return false;
    } else if (textField == self.majorTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.majorTF WithContentArray:self.majorTFArray];
        return false;
    } else if (textField == self.educationTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.educationTF WithContentArray:self.educationTFArray];
        return false;
    } else if (textField == self.isWorkonsocialTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.isWorkonsocialTF WithContentArray:self.isWorkonsocialTFArray];
        return false;
    } else if (textField == self.workOrgnatrueTF) {
        if (!self.isCheck) [self showSelectControllerForTextField:self.workOrgnatrueTF WithContentArray:self.workOrgnatrueTFArray];
        return false;
    } else if (textField == self.workAreaTF) {
        if (!self.isCheck) [self showMultipleSelectViewWithArray:self.workAreaTFArray forTextfield:self.workAreaTF];
        return false;
    } else if (textField == self.addressTF) {
        if (!self.isCheck) [self showLocationSelectControllerForTextField:self.addressTF WithTitle:@"请选择所在地区"];
        return false;
    }
    if (self.isCheck) {
        return false;
    } else {
        return true;
    }
}

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
    if (textField == self.personalIDCardTF) {
        if ([textField.text isEqualToString:@""]) {
            return true;
        } else if (![ValidateUtils validateIDCardNumber:textField.text]) {
            [MBProgressHUD showTipMessageInWindow:@"身份证输入有误"];
        } else {
            //截取身份证中出行人出生日期中的年、月、日
            NSString *personYear = [textField.text substringWithRange:NSMakeRange(6, 4)];
            NSString *personMonth = [textField.text substringWithRange:NSMakeRange(10, 2)];
            NSString *personDay = [textField.text substringWithRange:NSMakeRange(12, 2)];
            NSMutableString *birthdayString = [[NSMutableString alloc] initWithString:personYear];
            [birthdayString appendFormat:@"-%@",personMonth];
            [birthdayString appendFormat:@"-%@",personDay];
            self.birthdayTF.text = birthdayString;
            //获取身份证号中的性别
            NSInteger gender = [ValidateUtils getGenderFromIdCard:textField.text];
            if (gender == 2) {//女
                self.sexTF.text = @"女";
            } else {
                self.sexTF.text = @"男";
            }
        }
    }
    return true;
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
    //判断加上输入的字符，是否超过界限specialityTF  experienceTF
    NSString *str = [NSString stringWithFormat:@"%@%@", textView.text, text];
    NSInteger MaxLength = 0;
    if (textView == self.experienceTV) {
        MaxLength = 2000;
    } else {
        MaxLength = 50;
    }
    if (str.length > MaxLength) {
        NSRange rangeIndex = [str rangeOfComposedCharacterSequenceAtIndex:MaxLength];
        if (rangeIndex.length == 1) {//字数超限
            textView.text = [str substringToIndex:MaxLength];
        }else{
            NSRange rangeRange = [str rangeOfComposedCharacterSequencesForRange:NSMakeRange(0, MaxLength)];
            textView.text = [str substringWithRange:rangeRange];
        }
        return NO;
    }
    return YES;
}

- (void)textViewDidChange:(UITextView *)textView {
    if ((textView == self.workOrgTV || textView == self.contactAddressTV || textView == self.specialityTV || textView == self.dutyTV) && textView.text.length > 49) textView.text = [textView.text substringToIndex:50];
    if (textView == self.experienceTV && textView.text.length > 1999) textView.text = [textView.text substringToIndex:2000];
}

//设置文本框只能输入数字
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    if (string.length == 0 ||  [string isEqualToString:@""]) return true;// 如果是删除字符，肯定是要通过的
    //如果是限制只能输入数字的文本框
    if (textField == self.personalIDCardTF) {
        if (![self validateIDCardNumber:string]) {
            return false;
        }
    }
    if (textField == self.fixedlineTelTF || textField == self.postalCodeTF || textField == self.telphoneTF) {
        if (![self validateNumber:string]) {
            return false;
        }
    }
    //否则返回yes,不限制其他textfield
    if (range.length == 1 && string.length == 0) {
        return YES;
    } else {
        //否则返回yes,不限制其他textfield
        if (textField == self.nameTF && textField.text.length >= 16) {
            textField.text = [textField.text substringToIndex:16];
            return NO;
        } else if (textField == self.personalIDCardTF && textField.text.length >= 18) {
            textField.text = [textField.text substringToIndex:18];
            return NO;
        } else if (textField == self.telphoneTF && textField.text.length >= 11) {
            textField.text = [textField.text substringToIndex:11];
            return NO;
        } else if (textField == self.certNumberTF && textField.text.length >= 32) {
            textField.text = [textField.text substringToIndex:32];
            return NO;
        } else if (textField == self.graduateSchoolTF && textField.text.length >= 16) {
            textField.text = [textField.text substringToIndex:16];
            return NO;
        } else if (textField == self.mailTF && textField.text.length >= 50) {
            textField.text = [textField.text substringToIndex:50];
            return NO;
        } else if (textField == self.fixedlineTelTF && textField.text.length >= 16) {
            textField.text = [textField.text substringToIndex:16];
            return NO;
        } else if (textField == self.postalCodeTF && textField.text.length >= 6) {
            textField.text = [textField.text substringToIndex:6];
            return NO;
        }
    }
    return YES;
}

- (BOOL)validateNumber:(NSString*)number {
    BOOL res =YES;
    NSCharacterSet* tmpSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
    int i =0;
    while (i < number.length) {
        NSString * string = [number substringWithRange:NSMakeRange(i,1)];
        NSRange range = [string rangeOfCharacterFromSet:tmpSet];
        if (range.length ==0) {
            res =NO;
            break;
        }
        i++;
    }
    return res;
}

- (BOOL)validateIDCardNumber:(NSString*)number {
    BOOL res =YES;
    NSCharacterSet* tmpSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789Xx"];
    int i =0;
    while (i < number.length) {
        NSString * string = [number substringWithRange:NSMakeRange(i,1)];
        NSRange range = [string rangeOfCharacterFromSet:tmpSet];
        if (range.length ==0) {
            res =NO;
            break;
        }
        i++;
    }
    return res;
}

- (NSArray *)sexTFArray {
    if (!_sexTFArray) {
        _sexTFArray = @[@"男",@"女"];
    }
    return _sexTFArray;
}
- (NSArray *)politicsStatusTFArray {
    if (!_politicsStatusTFArray) {
        _politicsStatusTFArray = @[@"中国共产党党员",@"中国共产主义青年团团员",@"群众",@"其他",@"中国共产党预备党员"];
    }
    return _politicsStatusTFArray;
}
- (NSArray *)nationTFArray {
    if (!_nationTFArray) {
        _nationTFArray = @[@"汉族", @"壮族", @"回族", @"苗族", @"维吾尔族", @"土家族", @"彝族", @"藏族", @"布依族", @"朝鲜族", @"蒙古族", @"满族",@"侗族", @"瑶族", @"白族", @"哈尼族", @"哈萨克族", @"黎族", @"傣族", @"畲族", @"傈僳族",@"仡佬族",@"东乡族", @"高山族", @"拉祜族", @"水族", @"佤族",  @"纳西族",@"羌族", @"土族",@"仫佬族", @"锡伯族", @"柯尔克孜族",@"达斡尔族",@"景颇族",@"毛南族",@"撒拉族", @"布朗族", @"塔吉克族", @"阿昌族", @"普米族",@"鄂温克族", @"怒族",@"京族",  @"基诺族",@"德昂族", @"保安族",@"俄罗斯族", @"裕固族",@"乌孜别克族", @"门巴族",@"鄂伦春族",@"独龙族", @"塔塔尔族", @"赫哲族",@"珞巴族"];
    }
    return _nationTFArray;
}
- (NSArray *)workerTypeTFArray {
    if (!_workerTypeTFArray) {
        _workerTypeTFArray = @[@"专业",@"从业"];
    }
    return _workerTypeTFArray;
}
- (NSArray *)certLevTFArray {
    if (!_certLevTFArray) {
        _certLevTFArray = @[@"助理社会工作师",@"社会工作师",@"高级社会工作师"];
    }
    return _certLevTFArray;
}
- (NSArray *)majorTFArray {
    if (!_majorTFArray) {
        _majorTFArray = @[@"社会工作",@"社会工作相近",@"其他"];
    }
    return _majorTFArray;
}
- (NSArray *)educationTFArray {
    if (!_educationTFArray) {
        _educationTFArray = @[@"专科",@"本科",@"硕士",@"博士"];
    }
    return _educationTFArray;
}
- (NSArray *)isWorkonsocialTFArray {
    if (!_isWorkonsocialTFArray) {
        _isWorkonsocialTFArray = @[@"否",@"是"];
    }
    return _isWorkonsocialTFArray;
}
- (NSArray *)workOrgnatrueTFArray {
    if (!_workOrgnatrueTFArray) {
        _workOrgnatrueTFArray = @[@"政府机关单位",@"事业单位",@"外资企业",@"私营企业",@"社会团体",@"境外机构",@"国有企业",@"民营非团体",@"机关",@"其他单位",@"民办非企业单位"];
    }
    return _workOrgnatrueTFArray;
}
- (NSArray *)workAreaTFArray {
    if (!_workAreaTFArray) {
        _workAreaTFArray = @[@"社会福利",@"社会救助",@"慈善事业",@"社区建设",@"婚姻家庭",@"医疗卫生",@"残障康复",@"教育辅助",@"就业援助",@"职工帮扶",@"犯罪预防",@"禁毒解毒",@"矫治帮教",@"人口计生",@"纠纷调解",@"紧急处置",@"困境儿童保护",@"失独家庭帮扶",@"受灾人群救助",@"外来务工人员服务",@"其他"];
    }
    return _workAreaTFArray;
}

- (UITableView *)tableView {
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-SafeAreaTopHeight)];
        _tableView.separatorInset = UIEdgeInsetsZero;
        _tableView.backgroundColor = UIColor.whiteColor;
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.tableFooterView = [UIView new];
        _tableView.backgroundColor = hexColor(EEEEEE);
        if (!self.isCheck) {
            _tableView.tableFooterView = self.tableViewFooterView;
        }
        [_tableView registerClass:LSInfoCollectTableViewCell.class forCellReuseIdentifier:SocialWorkerFoundationInfoCollectCellID];
    }
    return _tableView;
}

- (UIView *)tableViewFooterView {
    if (!_tableViewFooterView) {
        _tableViewFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 100)];
        UIButton *submitButton = [[UIButton alloc] initWithFrame:CGRectMake(15, 30, ScreenWidth-30, 40)];
        [submitButton setTitle:@"提交" forState:UIControlStateNormal];
        [submitButton setTitleColor:hexColor(ffffff) forState:UIControlStateNormal];
        submitButton.titleLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14];
        submitButton.backgroundColor = hexColor(FDBB2C);
        submitButton.layer.cornerRadius = 4;
        submitButton.layer.masksToBounds = true;
        [submitButton addTarget:self action:@selector(submitButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [_tableViewFooterView addSubview:submitButton];
    }
    return _tableViewFooterView;
}

- (NSArray *)contentArray {
    if (!_contentArray) {
        _contentArray = @[@"姓名：",
                          @"身份证号：",
                          @"性别：",
                          @"出生日期：",
                          @"政治面貌：",
                          @"民族：",
                          @"所在地区：",
                          @"社工类型：",
                          @"毕业院校：",
                          @"毕业时间：",
                          @"所属专业：",
                          @"学历：",
                          @"目前是否从事社会工作：",
                          @"邮箱：",
                          @"工作单位：",
                          @"工作单位性质：",
                          @"职务：",
                          @"固定电话：",
                          @"邮编：",
                          @"联系地址：",
                          @"手机号码：",
                          @"工作领域：",
                          @"社会工作专长：",
                          @"社会工作经历："
                          ];
    }
    return _contentArray;
}

- (NSArray *)contentArray_isProfessional {
    if (!_contentArray_isProfessional) {
        _contentArray_isProfessional = @[@"姓名：",
                                         @"身份证号：",
                                         @"性别：",
                                         @"出生日期：",
                                         @"政治面貌：",
                                         @"民族：",
                                         @"所在地区：",
                                         @"社工类型：",
                                         @"证书管理号：",
                                         @"证书等级：",
                                         @"获取证书日期：",
                                         @"毕业院校：",
                                         @"毕业时间：",
                                         @"所属专业：",
                                         @"学历：",
                                         @"目前是否从事社会工作：",
                                         @"邮箱：",
                                         @"工作单位：",
                                         @"工作单位性质：",
                                         @"职务：",
                                         @"固定电话：",
                                         @"邮编：",
                                         @"联系地址：",
                                         @"手机号码：",
                                         @"工作领域：",
                                         @"社会工作专长：",
                                         @"社会工作经历："
                                         ];
    }
    return _contentArray_isProfessional;
}

- (UITextField *)nameTF {
    if (!_nameTF) {
        _nameTF = [[UITextField alloc] init];
        _nameTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _nameTF.delegate = self;
    }
    return _nameTF;
}

- (UITextField *)personalIDCardTF {
    if (!_personalIDCardTF) {
        _personalIDCardTF = [[UITextField alloc] init];
        _personalIDCardTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _personalIDCardTF.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
        _personalIDCardTF.delegate = self;
    }
    return _personalIDCardTF;
}

- (UITextField *)sexTF {
    if (!_sexTF) {
        _sexTF = [[UITextField alloc] init];
        _sexTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
//        if (!self.isCheck) {
//            UIImageView *sexTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
//            sexTFRightViewImageView.contentMode = UIViewContentModeCenter;
//            sexTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
//            _sexTF.rightView = sexTFRightViewImageView;
//            _sexTF.rightViewMode = UITextFieldViewModeAlways;
//        }
        _sexTF.delegate = self;
    }
    return _sexTF;
}

- (UITextField *)birthdayTF {
    if (!_birthdayTF) {
        _birthdayTF = [[UITextField alloc] init];
        _birthdayTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *birthdayTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            birthdayTFRightViewImageView.contentMode = UIViewContentModeCenter;
            birthdayTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _birthdayTF.rightView = birthdayTFRightViewImageView;
            _birthdayTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _birthdayTF.delegate = self;
    }
    return _birthdayTF;
}

- (UITextField *)politicsStatusTF {
    if (!_politicsStatusTF) {
        _politicsStatusTF = [[UITextField alloc] init];
        _politicsStatusTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *politicsStatusTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            politicsStatusTFRightViewImageView.contentMode = UIViewContentModeCenter;
            politicsStatusTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _politicsStatusTF.rightView = politicsStatusTFRightViewImageView;
            _politicsStatusTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _politicsStatusTF.delegate = self;
    }
    return _politicsStatusTF;
}

- (UITextField *)nationTF {
    if (!_nationTF) {
        _nationTF = [[UITextField alloc] init];
        _nationTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *nationTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            nationTFRightViewImageView.contentMode = UIViewContentModeCenter;
            nationTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _nationTF.rightView = nationTFRightViewImageView;
            _nationTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _nationTF.delegate = self;
    }
    return _nationTF;
}

- (UITextField *)addressTF {
    if (!_addressTF) {
        _addressTF = [[UITextField alloc] init];
        _addressTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *addressTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            addressTFRightViewImageView.contentMode = UIViewContentModeCenter;
            addressTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _addressTF.rightView = addressTFRightViewImageView;
            _addressTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _addressTF.delegate = self;
    }
    return _addressTF;
}

- (UITextField *)workerTypeTF {
    if (!_workerTypeTF) {
        _workerTypeTF = [[UITextField alloc] init];
        _workerTypeTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *workerTypeTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            workerTypeTFRightViewImageView.contentMode = UIViewContentModeCenter;
            workerTypeTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _workerTypeTF.rightView = workerTypeTFRightViewImageView;
            _workerTypeTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _workerTypeTF.delegate = self;
    }
    return _workerTypeTF;
}

- (UITextField *)certNumberTF {
    if (!_certNumberTF) {
        _certNumberTF = [[UITextField alloc] init];
        _certNumberTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _certNumberTF.delegate = self;
    }
    return _certNumberTF;
}

- (UITextField *)certLevTF {
    if (!_certLevTF) {
        _certLevTF = [[UITextField alloc] init];
        _certLevTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *certLevTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            certLevTFRightViewImageView.contentMode = UIViewContentModeCenter;
            certLevTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _certLevTF.rightView = certLevTFRightViewImageView;
            _certLevTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _certLevTF.delegate = self;
    }
    return _certLevTF;
}

- (UITextField *)certDateTF {
    if (!_certDateTF) {
        _certDateTF = [[UITextField alloc] init];
        _certDateTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *certDateTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            certDateTFRightViewImageView.contentMode = UIViewContentModeCenter;
            certDateTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _certDateTF.rightView = certDateTFRightViewImageView;
            _certDateTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _certDateTF.delegate = self;
    }
    return _certDateTF;
}

- (UITextField *)graduateSchoolTF {
    if (!_graduateSchoolTF) {
        _graduateSchoolTF = [[UITextField alloc] init];
        _graduateSchoolTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _graduateSchoolTF.delegate = self;
    }
    return _graduateSchoolTF;
}

- (UITextField *)graduateDateTF {
    if (!_graduateDateTF) {
        _graduateDateTF = [[UITextField alloc] init];
        _graduateDateTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *graduateDateTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            graduateDateTFRightViewImageView.contentMode = UIViewContentModeCenter;
            graduateDateTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _graduateDateTF.rightView = graduateDateTFRightViewImageView;
            _graduateDateTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _graduateDateTF.delegate = self;
    }
    return _graduateDateTF;
}

- (UITextField *)majorTF {
    if (!_majorTF) {
        _majorTF = [[UITextField alloc] init];
        _majorTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *majorTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            majorTFRightViewImageView.contentMode = UIViewContentModeCenter;
            majorTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _majorTF.rightView = majorTFRightViewImageView;
            _majorTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _majorTF.delegate = self;
    }
    return _majorTF;
}

- (UITextField *)educationTF {
    if (!_educationTF) {
        _educationTF = [[UITextField alloc] init];
        _educationTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *educationTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            educationTFRightViewImageView.contentMode = UIViewContentModeCenter;
            educationTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _educationTF.rightView = educationTFRightViewImageView;
            _educationTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _educationTF.delegate = self;
    }
    return _educationTF;
}

- (UITextField *)isWorkonsocialTF {
    if (!_isWorkonsocialTF) {
        _isWorkonsocialTF = [[UITextField alloc] init];
        _isWorkonsocialTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *isWorkonsocialTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            isWorkonsocialTFRightViewImageView.contentMode = UIViewContentModeCenter;
            isWorkonsocialTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _isWorkonsocialTF.rightView = isWorkonsocialTFRightViewImageView;
            _isWorkonsocialTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _isWorkonsocialTF.delegate = self;
    }
    return _isWorkonsocialTF;
}

- (UITextField *)mailTF {
    if (!_mailTF) {
        _mailTF = [[UITextField alloc] init];
        _mailTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _mailTF.keyboardType = UIKeyboardTypeEmailAddress;
        _mailTF.delegate = self;
    }
    return _mailTF;
}

- (NZKTextView *)workOrgTV {
    if (!_workOrgTV) {
        _workOrgTV = [[NZKTextView alloc] init];
        _workOrgTV.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _workOrgTV.delegate = self;
        //内容缩进为0（去除左右边距）
        _workOrgTV.textContainer.lineFragmentPadding = 0;
        //文本边距设为0（去除上下边距）
        _workOrgTV.textContainerInset = UIEdgeInsetsMake(10, 0, 8, 0);
        _workOrgTV.placeHolder = @"限制在50字以内";
    }
    return _workOrgTV;
}

- (UITextField *)workOrgnatrueTF {
    if (!_workOrgnatrueTF) {
        _workOrgnatrueTF = [[UITextField alloc] init];
        _workOrgnatrueTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *workOrgnatrueTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            workOrgnatrueTFRightViewImageView.contentMode = UIViewContentModeCenter;
            workOrgnatrueTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _workOrgnatrueTF.rightView = workOrgnatrueTFRightViewImageView;
            _workOrgnatrueTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _workOrgnatrueTF.delegate = self;
    }
    return _workOrgnatrueTF;
}

- (NZKTextView *)dutyTV {
    if (!_dutyTV) {
        _dutyTV = [[NZKTextView alloc] init];
        _dutyTV.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _dutyTV.delegate = self;
        _dutyTV.placeHolder = @"限制在50字以内";
    }
    return _dutyTV;
}

- (UITextField *)fixedlineTelTF {
    if (!_fixedlineTelTF) {
        _fixedlineTelTF = [[UITextField alloc] init];
        _fixedlineTelTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _fixedlineTelTF.keyboardType = UIKeyboardTypePhonePad;
        _fixedlineTelTF.delegate = self;
    }
    return _fixedlineTelTF;
}

- (UITextField *)postalCodeTF {
    if (!_postalCodeTF) {
        _postalCodeTF = [[UITextField alloc] init];
        _postalCodeTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _postalCodeTF.keyboardType = UIKeyboardTypeNumberPad;
        _postalCodeTF.delegate = self;
    }
    return _postalCodeTF;
}

- (NZKTextView *)contactAddressTV {
    if (!_contactAddressTV) {
        _contactAddressTV = [[NZKTextView alloc] init];
        _contactAddressTV.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _contactAddressTV.delegate = self;
        //内容缩进为0（去除左右边距）
        _contactAddressTV.textContainer.lineFragmentPadding = 0;
        //文本边距设为0（去除上下边距）
        _contactAddressTV.textContainerInset = UIEdgeInsetsMake(10, 0, 8, 0);
        _contactAddressTV.placeHolder = @"限制在50字以内";
    }
    return _contactAddressTV;
}

- (UITextField *)telphoneTF {
    if (!_telphoneTF) {
        _telphoneTF = [[UITextField alloc] init];
        _telphoneTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _telphoneTF.keyboardType = UIKeyboardTypePhonePad;
        _telphoneTF.delegate = self;
    }
    return _telphoneTF;
}

- (UITextField *)workAreaTF {
    if (!_workAreaTF) {
        _workAreaTF = [[UITextField alloc] init];
        _workAreaTF.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        if (!self.isCheck) {
            UIImageView *workAreaTFRightViewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44-8, 44-8)];
            workAreaTFRightViewImageView.contentMode = UIViewContentModeCenter;
            workAreaTFRightViewImageView.image = [UIImage imageNamed:@"xiala"];
            _workAreaTF.rightView = workAreaTFRightViewImageView;
            _workAreaTF.rightViewMode = UITextFieldViewModeAlways;
        }
        _workAreaTF.delegate = self;
    }
    return _workAreaTF;
}

- (NZKTextView *)specialityTV {
    if (!_specialityTV) {
        _specialityTV = [[NZKTextView alloc] init];
        _specialityTV.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _specialityTV.delegate = self;
        //内容缩进为0（去除左右边距）
        _specialityTV.textContainer.lineFragmentPadding = 0;
        //文本边距设为0（去除上下边距）
        _specialityTV.textContainerInset = UIEdgeInsetsMake(10, 0, 8, 0);
        _specialityTV.placeHolder = @"限制在50字以内";
    }
    return _specialityTV;
}

- (NZKTextView *)experienceTV {
    if (!_experienceTV) {
        _experienceTV = [[NZKTextView alloc] init];
        _experienceTV.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:FontSize];
        _experienceTV.delegate = self;
        //内容缩进为0（去除左右边距）
        _experienceTV.textContainer.lineFragmentPadding = 0;
        //文本边距设为0（去除上下边距）
        _experienceTV.textContainerInset = UIEdgeInsetsMake(10, 0, 8, 0);
        _experienceTV.placeHolder = @"限制在2000字以内";
    }
    return _experienceTV;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
